﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Drawing;
using Google.KML;
using System.IO;
using System.Diagnostics;
using MSAProject.AltitudeColor;

namespace MSAProject
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            KmlGenerator kmlGenerator = new KmlGenerator(fileName.Text, "Minimum_Safe_Altitude");
            TerrainFieldGenerator terrainGen = new TerrainFieldGenerator();
            List<TerrainField> terrainList = new List<TerrainField>();
            terrainList = terrainGen.GenerateFields(60);
            foreach (TerrainField field in terrainList) {
                kmlGenerator.AddPolygon(field);
            }
            kmlGenerator.GenerateKmlFile();
        }

        private void fileName_TextChanged(object sender, TextChangedEventArgs e)
        {

        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            ProcessStartInfo psInfGE = new ProcessStartInfo("C:\\Program Files\\Google\\Google Earth\\client\\googleearth.exe", fileName.Text);
            Process.Start(psInfGE);
        }
    }
}
